#include "opencv2/opencv.hpp"
#include "MVCamera.h"

#define FRAME_WIDTH 678
#define FRAME_HEIGHT 512

int main() {
	mvc::MVCamera mvCamera(0);
	mvCamera.setOutputSize(FRAME_WIDTH, FRAME_HEIGHT);
	mvCamera.openCamera();
	mvCamera.startGrabbing();
	cv::Mat frame;
	while (true) {
		if (mvCamera.readFrame(frame)) {
			cv::imshow("frame", frame);
		} else {
			cv::imshow("frame", cv::Mat(100, 100, CV_8UC3));
		}
		int k = cv::waitKey(1);
		if (k == 27) {
			cv::destroyAllWindows();
			mvCamera.stopGrabbing();
			mvCamera.closeCamera();
			break;
		}
	}
	return 0;
}
